Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WithSpan annotation instrumentation #929

Merged
merged 4 commits into from
Aug 10, 2020

Conversation

trask
Copy link
Member

@trask trask commented Aug 8, 2020

Resolves #913

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

}

// OpenTelemetry Auto Annotations shaded so that it can be used in opentelemetry-api-beta
// instrumentation, and then its usage can be unshaded after OpenTelemetry API is shaded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm this means our unit tests can catch the issue in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, no, this was needed for the fix. currently at least we have to rely on smoke tests to catch shading-related problems. probably we should create a whole smoke test around instrumentation OpenTelemetry API, since that instrumentation is shading-fragile. i will open issue........ (a couple min later) oh ya, i have an issue already for that: #298 😄

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WebController {
@RequestMapping("/greeting")
public String greeting() {
return "Sup Dawg";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change

@iNikem
Copy link
Contributor

iNikem commented Aug 9, 2020

I will continue spreading confusion :)

First, I don't understand what exactly was broken? Our instrumentation depended and referenced WithSpan class directly, meaning that it referenced the correct class in the correct package. It worked before without shading, why it stopped working?

@trask
Copy link
Member Author

trask commented Aug 9, 2020

It worked before without shading, why it stopped working?

It stopped working as soon as WithSpan.kind() was added.

The reason it stopped working is because the type of kind is io.opentelemetry.trace.Span.Kind, and so during shading, our call to

io/opentelemetry/extensions/auto/annotations/WithSpan.kind()Lio/opentelemetry/trace/Span$Kind;

was shaded to call

io/opentelemetry/extensions/auto/annotations/WithSpan.kind()Lio/opentelemetry/auto/shaded/io/opentelemetry/trace/Span$Kind;

and then muzzle kicked in at runtime and said that method does exist, and so it disabled the annotations instrumentation

@trask trask merged commit 2c786ab into open-telemetry:master Aug 10, 2020
@trask trask deleted the fix-with-span branch August 10, 2020 04:46
mabdinur pushed a commit to mabdinur/opentelemetry-java-instrumentation that referenced this pull request Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@WithSpan annotation not functioning with 0.7.0
3 participants